package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.Template;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by zhangjh on 2016/11/16.
 */
@Component
public interface TemplateRepository  extends JpaRepository<Template, Long>, JpaSpecificationExecutor, TemplateRepositoryCustom {

    List<Template> findByMallIdAndIsDeleteOrderBySeqNoAsc(Long mallId, Whether isDelete);

    Template findByIdAndMallIdAndIsDelete(Long id, Long mallId, Whether no);

    List<Template> findByTitleAndMallIdAndIsDeleteOrderBySeqNoAsc(String title, Long mallId, Whether no);


    Template findTop1ByMallIdAndIsDeleteOrderBySeqNoDesc(Long mallId, Whether no);

    Template findByIdAndIsDelete(Long id, Whether no);

    List<Template> findByTitleAndIsDeleteOrderBySeqNoAsc(String title, Whether no);

    List<Template> findByIsDeleteOrderBySeqNoAsc(Whether no);

    Template findTop1ByIsDeleteOrderBySeqNoDesc(Whether no);

}
